package com.cx.mapper;

import com.cx.entity.Dept;
import org.apache.ibatis.annotations.*;

@Mapper
public interface DeptMapper {
    //    方法在这里写

    //    查询一个
    @Select("select dept_id deptId,dept_name deptName from dept where dept_id=#{id}")
    Dept getDeptById(int id);

    // 修改
    @Update("update dept set dept_name=#{deptName} where dept_id=#{deptId}")
    int updateDept(Dept dept);

    // 删除
    @Delete("delete from dept where dept_id=#{id}")
    int deleteDeptById(int id);

    // 新增
    @Insert("insert into dept(dept_name) values (#{deptName})")
    int insertDept(Dept dept);
}
